/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-10-20
 * Time: 16:04
 */
public class Test1 {
    public int flag;
    public StringBuffer stringBuffer = new StringBuffer();
    public String solve (String s, String t) {
        // write code here
        if(s == "" && t == "") {
            return "";
        }
        sum(s,t);
        return stringBuffer.reverse().toString();
    }
    private void sum(String s, String t) {
        if (s.length() != 0 && t.length() == 0) {
            sum(s);
            return;
        }
        if(s.length() == 0 && t.length() != 0) {
            sum(t);
            return;
        }
        if(s.length() == 0 && t.length() == 0) {
            return;
        }
        String str1 = s.substring(s.length()-1,s.length());
        int data1;
        data1 = Integer.parseInt(str1) % 10;
        String str2 = t.substring(t.length()-1,t.length());
        int data2;
        data2 = Integer.parseInt(str2) % 10;
        int sum = data1 + data2 + flag;
        if (sum < 10) {
            flag = 0;
            stringBuffer.append(sum);
        } else {
            flag = 1;
            stringBuffer.append(sum % 10);
        }
        if(s.length()-1 > 0 && t.length()-1 > 0) {
            sum(s.substring(0, s.length() - 1), t.substring(0, t.length() - 1));
            return;
        }else if(!(s.length()-1 > 0) && t.length()-1 > 0) {
            sum(t.substring(0,t.length() - 1));
            return;
        }else if (s.length()-1 > 0 && !(t.length()-1 > 0)) {
            sum(s.substring(0,s.length() - 1));
            return;
        }

        if(flag == 1) {
            stringBuffer.append(1);
        }
    }
    private void sum(String s) {
        if(s.length() == 0) {
            return;
        }
        String str = s.substring(s.length()-1, s.length());
        int sum = Integer.parseInt(str) % 10 + flag;
        if (sum < 10) {
            flag = 0;
            stringBuffer.append(sum);
        } else {
            flag = 1;
            stringBuffer.append(sum % 10);
        }
        sum(s.substring(0, s.length() - 1));
        if(flag == 1) {
            stringBuffer.append(1);
        }
    }

    public static void main(String[] args) {
        Test1 test1 = new Test1();
        String str = test1.solve("1","99");
        System.out.println(str);
    }
}
